package com.coldchain;

import com.coldchain.authclient.interceptor.UserAuthRestInterceptor;
import com.spring4all.swagger.EnableSwagger2Doc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.RequestMapping;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients(value={"com.coldchain.authclient.feign", "com.coldchain.common.feign"})
@EnableTransactionManagement
@EnableScheduling
@EnableSwagger2
@EnableSwagger2Doc
@Controller
public class ServerOrderMain {
    public static void main(String[] args) {
    	SpringApplication.run(ServerOrderMain.class, args);
    }
    				  
    @RequestMapping("/order/v2/api-docs")
    public String  apiDoc(){
        return "redirect:/v2/api-docs";
    }
    
    @Bean
    public TaskScheduler taskScheduler(){
    	ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
    	taskScheduler.setPoolSize(1);
    	taskScheduler.setThreadNamePrefix("Create settlement order");
    	return taskScheduler;
    }
    
    
}
